package com.qf.controller;

import com.qf.Movie;
import com.qf.ResultVo;
import com.qf.dto.SearchDTO;
import com.qf.service.MovieSearchService;
import com.qf.vo.PageResultVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 作者：Xx凯丶
 * 时间：2022/4/19 15:29
 */
@RestController
@RequestMapping("/moviesearch")
@CrossOrigin
public class MovieSearchController {
    @Autowired
    MovieSearchService movieSearchService;
    @RequestMapping("/searchall")
    public ResultVo searchAllMovie(){
        return new ResultVo(200,"SUCCESS",movieSearchService.findAllMovie());
    }
    @RequestMapping("/searchbucket")
    public ResultVo searchBucket(){
        return new ResultVo(200,"SUCCESS",movieSearchService.findBucket());
    }
    @RequestMapping("/search")
    public PageResultVo<Movie> search(@RequestBody SearchDTO searchDTO){

        return movieSearchService.search(searchDTO);
    }
}
